<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	    <title>提现</title>  
	    <link rel="stylesheet" href="../libs/mui/mui.css" />
	    <link rel="stylesheet" href="../css/mui.min.css">
	    <link rel="stylesheet" type="text/css" href="../css/main.css"/>
		<link rel="stylesheet" type="text/css" href="../libs/iconfont/fonts/iconfont.css" />
		<style>
			b{color: #ff043f;}
			h5{padding: 6px 15px;color: #FF5053;}
			label{margin-bottom: 6px;display: block;}
			.mui-radio input[type=radio]:checked:before {content: '\e442';}
			.mui-radio input[type=radio]:checked:before {color: #2875f5;}
			.mui-radio i{font-size: 28px;}		
			.mui-input-row label{text-align: left;padding-left: 15px;padding-right:0px;width:30%;color: black;}
			.mui-input-row label~input{width: 70%;}
			/*选择按钮*/				
			.chose>button{background-color: white; border: 1px solid #DDDDDD; color: black;margin-right: 5px;padding: 6px 15px;}			
			.back-orange {background: #338efc !important;color: white!important;border: 1px solid #338efc!important;}		
		</style>		
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">提现</h1>
		</header>
		<div class="mui-content">
			<div class="Indiv">
				<div class="mui-table-view">
					<div class="mui-table-view-cell">
						<label class="gray">请输入提现金额</label>
						<input type="text" class="pay_ment" id="pay_ment" placeholder="0.00元"/>
						<p class="chose">
							<button type="button" class="mui-btn">50元</button>
							<button type="button" class="mui-btn">100元</button>
							<button type="button" class="mui-btn">200元</button>
							<button type="button" class="mui-btn">500元</button>
						</p>
					</div>
				</div> 
				<div class="mui-table-view">
					<div class="mui-table-view-cell">
						<label class="gray">提现到支付宝账号</label>
						<input type="text" class="bank_no" placeholder="请输入"/>
					</div>			
				</div>				
			</div>		
			<h5>提示：请核实支付宝账号</h5>
			<div class="res_pasw">
				<button type="button">立即提现</button>
			</div>
		</div>
		<script type="text/javascript" src="../js/open.js"></script>
		<script type="text/javascript" src="../js/mui.js"></script>
		<script type="text/javascript" src="../libs/jquery/jquery.js"></script>
		<script type="text/javascript" src="../js/web_js/public.js"></script>
		<script>
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});			
		</script>
		<script>
			document.addEventListener('plusready',function(){
				var ws = plus.webview.currentWebview();
				var spage = ws.spage;
				$('.res_pasw').on('click',function(){
					var member_id = plus.storage.getItem('id');
					var pay_ment = $(".pay_ment").val();
					var bank_no = $('.bank_no').val();
					var aa = pay_ment.indexOf("元");
					if(aa >= 0){
						var pay_ment = parseInt(pay_ment);
					}
					if(!bank_no){
						toast('支付宝账号不能为空！');return;
					}
					var timestamp = new Date().getTime();
//					console.log(pay_ment+'--'+timestamp+'--'+bank_no);
					$.ajax({ 
						type:"post",
						url:apiRoot + "?act=member_buy&op=withdrawals",
						data:{
							member_id:member_id,
							pay_sn:timestamp,
							bank_no:bank_no,
							price:pay_ment
						},  
						dataType:'json', 
						success:function(data){
				//			console.log(JSON.stringify(data));
							if(data.code == 200){
								toast('提现申请成功！等待管理员操作！');
								plus.webview.getWebviewById(spage).reload();
								setTimeout(function(){
									ws.close();
								},1000)
							}else{
								toast(data.datas.error);  
							} 
						},
						error:function(e){
							error();
						}
					});
				})
			})
			    
		</script>
		<script>
			$(".chose>button").each(function(i){
	            var $this = $(this);
	            $this.on('tap',function(){
	                $(".chose>button").removeClass('back-orange');
	                $this.addClass('back-orange');
	                var pay = $this.text();
	                $('.pay_ment').val(pay);
	            });
	        });
	        pay_ment.addEventListener("input", function(event) {
	        	var pay_ment = $(".pay_ment").val();
	        	if(!pay_ment.match(numb)){
	        		toast('请输入非0开头的整数'); 
	        	}
			     $(".chose>button").removeClass('back-orange');
			})
		</script>
	</body>
</html>